package components;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;

public class AlertDialogManager {
	public static AlertDialog createAlertDialog(Context context, String title,
			String message, String rightButtonTitle,
			DialogInterface.OnClickListener rightClickListener,
			String leftButtonTitle,
			DialogInterface.OnClickListener leftButtonListener) {
		AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
				context);

		// set title
		alertDialogBuilder.setTitle(title);

		// set dialog message
		alertDialogBuilder.setMessage(message).setCancelable(false)
				.setPositiveButton(rightButtonTitle, rightClickListener)
				.setNegativeButton(leftButtonTitle, leftButtonListener);

		// create alert dialog
		AlertDialog alertDialog = alertDialogBuilder.create();

		return alertDialog;
	}
	public static AlertDialog createAlertDialog(Context context, int titleId,
			String message, int rightButtonId,
			DialogInterface.OnClickListener rightClickListener,
			int leftButtonId,
			DialogInterface.OnClickListener leftButtonListener) {
		return createAlertDialog(context, context.getString(titleId), message, context.getString(rightButtonId), rightClickListener,
				context.getString(leftButtonId), leftButtonListener);
	}
	
	public static AlertDialog createAlertDialog(Context context, String title,
			String message, String rightButtonTitle,
			DialogInterface.OnClickListener rightClickListener) {
		AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
				context);

		// set title
		alertDialogBuilder.setTitle(title);

		// set dialog message
		alertDialogBuilder.setMessage(message).setCancelable(false)
				.setPositiveButton(rightButtonTitle, rightClickListener);

		// create alert dialog
		AlertDialog alertDialog = alertDialogBuilder.create();

		return alertDialog;
	}
	
	public static AlertDialog createAlertDialog(Context context, int titleId,
			int message, int rightButtonTitleId,
			DialogInterface.OnClickListener rightClickListener) {
		return createAlertDialog(context, context.getString(titleId), context.getString(message), context.getString(rightButtonTitleId), rightClickListener);
	}

}
